package com.es.entity;

import lombok.Data;
import lombok.NoArgsConstructor;
import org.elasticsearch.common.geo.GeoPoint;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.data.elasticsearch.annotations.GeoPointField;

import java.io.Serializable;

/**
 * Copyright
 *
 * @Author WuHuang
 * @Date 2022/5/24
 */

@Data
@NoArgsConstructor
@Document(indexName = "depot", type = "carpark")
//indexName索引名称 可以理解为数据库名 必须为小写 不然会报org.elasticsearch.indices.InvalidIndexNameException异常
//type类型 可以理解为表名
public class NewCarPark implements Serializable {
    private static final long serialVersionUID = 2084886055991558899L;

    /**
     * 停车场id
     */
    @Id
    @Field(type = FieldType.Long)
    private Long id;

    /**
     * 停车场名称
     */
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String name;

    /**
     * 停车场类型 0路边 1场库
     */
    @Field(type = FieldType.Integer)
    private Integer type;

    /**
     * 停车场图片链接
     */
    @Field(type = FieldType.Keyword)
    private String picture;


    /**
     * 地理位置
     */
    @GeoPointField
    private GeoPoint location;

    @Field(type = FieldType.Keyword)
    private String address;

    /**
     * 收费模板id
     */
    @Field(type = FieldType.Long)
    private Long billingRulesId;

    /**
     * 开始时间
     */
    @Field(type = FieldType.Keyword)
    private String startDate;

    /**
     * 结束时间
     */
    @Field(type = FieldType.Keyword)
    private String endDate;

}
